package cn.zxh.improvement.common.core.enums;

import java.util.Optional;

/**
 * 状态
 *
 * @author zxh
 * @since 2023/5/8 16:18:36
 */
public enum ValidStatus implements BaseEnum<ValidStatus, Integer> {
    /**
     * 通过
     */
    VALID(1, "valid"),
    /**
     * 不通过
     */
    INVALID(0, "invalid"),
    ;

    private final Integer code;
    private final String name;

    ValidStatus(Integer code, String msg) {
        this.code = code;
        this.name = msg;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static Optional<ValidStatus> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(ValidStatus.class, code));
    }
}
